# -*- coding: utf-8 -*-
# @Author: garlic
# @Date:   2019-04-08 16:05:58
# @Last Modified by:   garlic
# @Last Modified time: 2019-04-08 16:05:58

import const
import logging
import sdk
import requests

##查询接口
def pay_query():
    __map = {}
    __map["app_id"] = const.GF_APPID
    __map["timestamp"] = sdk.getNow()
    __map["version"] = const.API_VERSION
    __map["store_code"] = const.STORE_CODE
    ## -------------
    ####// 二选一
    ####// 1...
    __map["trade_no"] = "634040815171435943097278"
    __map["trade_no_type"] = "1"
    ## 2...
    ## __map["down_trade_no"] = "657970c7-897c-4376-a5ca-d05e28d7d874"
    ## __map["trade_no_type"] = "2"
    ## ---------------
    __map["pay_channel"] = "ALIPAY" ##### WECHAT / ALIPAY
    __map["sign"] = sdk.doSign(__map)

    # 请求
    response = requests.post(const.GF_API_URL_PREFIX + const.API_VERSION  + "/pay/query", params=__map)

    logging.info(response.text)